import request from '@/utils/request'

/**获取分类 */
export const classifyList = ({ id, grade, parent }) =>
  request({
    url: '/api/classify/list',
    method: 'get',
    params: {
      id,
      grade,
      parent,
    },
  })
/**获取分类操作记录 */
export const classifyRecord = ({ page, size }) =>
  request({
    url: '/api/classify/record',
    method: 'get',
    params: {
      page,
      size,
    },
  })
/**还原分类操作记录 */
export const classifyReduction = ({ id }) =>
  request({
    url: '/api/classify/reduction',
    method: 'post',
    data: {
      id,
    },
  })
/**获取父级分类 */
export const classifyParent = ({ id }) =>
  request({
    url: '/api/classify/parent',
    method: 'get',
    params: {
      id,
    },
  })
/**新增分类 */
export const classifyAdd = ({ name, grade, parent }) =>
  request({
    url: '/api/classify/add',
    method: 'post',
    data: {
      name,
      grade,
      parent,
    },
  })
/**分类重命名 */
export const classifyRename = ({ id, name }) =>
  request({
    url: '/api/classify/rename',
    method: 'post',
    data: {
      id,
      name,
    },
  })
/**分类移动 */
export const classifyMove = ({ id, grade, parent }) =>
  request({
    url: '/api/classify/move',
    method: 'post',
    data: {
      id,
      grade,
      parent,
    },
  })
/**删除分类 */
export const classifyDel = ({ id }) =>
  request({
    url: '/api/classify/del',
    method: 'post',
    data: {
      id,
    },
  })
/**批量删除分类 */
export const classifyDels = ({ ids }) =>
  request({
    url: '/api/classify/dels',
    method: 'post',
    data: {
      ids,
    },
  })
